from unittest import TestCase
import requests
# Create your tests here.


class dealerTest(TestCase):
    base_url = 'http://127.0.0.1:8000'

    def test_addDealer(self):
        url = self.base_url + '/dealer/addDealer/'
        json_data = {
            'company': '陕西喊山酒业',
            "address": '辛家庙',
            'name': '伏虎',
            'phone': '456',
            'area': '雁塔',
            'level': 'A',
            'staff_id': '45f0a1f90df148e3a2693a5494db95a9',
            'status': '正常'
        }
        resp = requests.post(url,data=json_data)
        print(resp.text)

    def test_findDealer(self):
        url = self.base_url + "/dealer/findDealer/?dealer_id=cd712e7a613d47ff9e34e2472d7d0330"
        resp = requests.get(url)
        print(resp.text)

    def test_alterDealer(self):
        url = self.base_url + '/dealer/alterDealer/'
        json_data = {
            'dealer_id': '85ed432b8add47a0995395aa0159d3f4',
            'company': '天上人间1',
            "address": '立人科技园',
            'name': '贾山',
            'phone': '123',
            'area': '高新',
            'level': 'A',
            'staff_id': '45f0a1f90df148e3a2693a5494db95a9',
            'status': '正常'
        }
        resp = requests.put(url,data=json_data)
        print(resp.text)